package com.itheima.homework;

import java.time.LocalDateTime;
import java.time.Year;
import java.time.format.DateTimeFormatter;

public class demo03 {
    public static void main(String[] args) {
        String str ="2020-12-12 12:23:12";
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime ldt = LocalDateTime.parse(str,dtf);
        System.out.println(ldt);
        LocalDateTime ldt2 = ldt
                .plusYears(1)
                .plusMonths(2)
                .plusDays(3)
                .plusHours(4)
                .plusMinutes(8)
                .plusSeconds(45);
        String format = ldt2.format(dtf);
        System.out.println(ldt2);
        System.out.println(str);
        System.out.println(format);
    }
}
